﻿/*
 * 设计模式 - 命令模式
 */


var person = new Person();
var command = new WashHandCommand(person);

command.Execute();

class Person
{
    public void WashHand()
    {
        Console.WriteLine("洗个手");
    }
}

interface ICommand
{
    void Execute();
}

class WashHandCommand : ICommand
{
    private readonly Person _person;

    public WashHandCommand(Person person)
    {
        _person = person;
    }
    public void Execute()
    {
        _person.WashHand();
    }
}